package cn.git;

import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;

import java.util.Arrays;

public class ConstructorInterceptor {

    /**
     * 被标注 RuntimeType 注解的方法就是拦截方法，此时返回的值与返回参数可以与被拦截的方法不一致
     * byteBuddy会在运行期间给被拦截的方法参数进行赋值
     * @return
     */
    @RuntimeType
    public void intercept(
            @This Object targetObject,
            @AllArguments Object[] targetMethodArgs) {
       System.out.println("增强构造方法参数intercept: " + Arrays.toString(targetMethodArgs));
    }

}
